import ticketsApi from 'api/tickets'

const state = {
  tickets_list: null
}
const getters = {
  tickets_list: state => state.tickets_list
}

const actions = {
  tickets_list ({ commit, state }, params) {
    return ticketsApi.ticketsList(params)
    .then((json) => {
      commit('TICKETS_LIST', json)
    })
    .catch(() => {})
  }
}

const mutations = {
  TICKETS_LIST (state, data) {
    state.tickets_list = data.data
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
